package Package;

import Package.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//第6章 依赖注入的应用
public class Di {
    public static void main(String[] args) {

        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("ApplicationContext.xml");

        //setter注入
        UserService userservice = (UserService) applicationContext.getBean("userservice1");

        //构造器注入

        //UserService userservice = (UserService) applicationContext.getBean("userservice");
        userservice.show();
    }
}
